package com.wqz.tacos.models;

import javax.validation.constraints.Size;
import javax.validation.constraints.NotNull;
import lombok.Data;

import java.util.Date;
import java.util.List;

/**
 * Taco类主要保存Taco的id与创建时间和taco的名字，并且保存与之对应的ingredients成分表
 */
@Data
public class Taco {
    // validation 需要在pom中手动引入

    /*
     * 调整对象适应持久化
     * 添加id作为对应的唯一标识
     */
    private Long id;
    private Date createTime;
    @NotNull
    @Size(min=5,message = "Name must be at least 5 characters long")
    private String name;

    /**
     * ingredients不该是String类型
     */
    @Size(min = 1, message = "You must be at least 1 ingredient")
    private List<Ingredient> ingredients;
}
